home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / pctj8406.arc / RANGE.PRG < prev    next >
Text File  |  1986-09-14  |  3KB  |  69 lines

  1.  
  2.  
  3.    SET TALK OFF
  4.    ERASE
  5.  
  6.    * - Validate the temperature in degrees Fahrenheit
  7.    * - initially, the condition "valid" is not true
  8.    STORE f TO valid
  9.  
  10.    * - initialize memvar for the temperature 
  11.    STORE 0000.0 TO todaystemp
  12.  
  13.    * - the loop repeats until a valid temperature is entered
  14.    DO WHILE (.not. valid)
  15.       CLEAR GETS
  16.  
  17.       @ 10,10  SAY "Please enter today's temperature "
  18.       * - "todaystemp" is a numeric memvar  
  19.       @ 10,$+2 GET todaystemp PICTURE "9999.9"
  20.       @ 10,$+2 SAY "degrees Fahrenheit"
  21.       READ
  22.       CLEAR GETS
  23.  
  24.       * - erase any old error message from line 11
  25.       @ 11, 0
  26.  
  27.       * - this is the actual range check
  28.       IF ( ( todaystemp < -99 ) .or. ( todaystemp > 150 ) )
  29.  
  30.          * - if the number is out of range, put out the message, 
  31.          * - surround it with blinking arrows, and ring the bell
  32.          @ 11, 17 SAY "Wild weather!  Please check that temperature."
  33.  
  34.          * - on an IBM PC, these color numbers cause blinking
  35.          SET COLOR TO 120,158
  36.          @ 11, $+2 SAY "<<<<<"
  37.          @ 11, 11  SAY ">>>>>"
  38.  
  39.          * - reset to normal colors
  40.          SET COLOR TO 120,7 
  41.          
  42.          * - ring the bell (or beep)
  43.          ?? CHR(7)
  44.  
  45.       ELSE - range check passed
  46.  
  47.          * - the temperature input is valid
  48.          STORE t TO valid
  49.  
  50.       ENDIF - range check
  51.    ENDDO - while not valid
  52.    RELEASE valid
  53.    QUIT
  54.  
  55. ***                                                                         
  56.                                                                              
  57.                                                                              
  58.                                                                              
  59.                                                                              
  60.                                                                              
  61.                                                                              
  62.                                                                              
  63.                                                                              
  64.                                                                              
  65.                                                                              
  66.                                                                              
  67.                                                                              
  68.                                                                              
  69.